The Input File

The scene description read by rayshade consists of a number of keywords, each followed by a set of arguments. These keywords can be thought of as commands that direct rayshade to do various things, such as create objects, set the eye's position, and change an object's appearance.

Many of the keywords have related command-line options for turning on special features and setting values. These options override the values given in the input file, and are explained in detail in Appendix A.

Rayshade is ``case sensitive,'' which means that typing SPHERE or Sphere instead of sphere won't work. Rayshade keywords are all lower-case. Many people choose to capitalize the first letter of names that they give to objects or surfaces in order to make then ``stand out'' in an input file.

Keywords, numbers and strings in the input file are separated by spaces, tabs, or new lines (carriage returns). These ``whitespace'' characters are handled identically by rayshade, which means that you can separate keywords from keywords, key words from arguments, and arguments from arguments using any combination of whitespace characters that you choose.


Table: Operators, in order of decreasing precedence.
Operator Use Operation
^ a ^ b Exponentiation
- -a Negation
* a * b Multiplication
/ a / b Division
% a % b Remainder
+ a + b Addition
- a - b Subtraction


Numbers may be entered directly as reals or as parenthesized expressions. Reals may be written in exponential notation if you wish, and integers may be written with or without a trailing decimal point. When an integer value is called for and a real is given, the real value is truncated and the resulting integer is used. Table [*] lists the available operators available for use in expressions, in order of decreasing precedence.

The upshot of all this is that the strings 42, 42., (20 + 22), and (7^2 - 7) mean the same thing to rayshade.

Variables may also be defined and used in expressions. Several built-in functions are also provided. See Appendix B for further details.

Rayshade will automatically run the input it receives through the C preprocessor if it is available. This allows you to use C preprocessor directives, such as #include, #define, and #ifdef when designing your input files.

Comments may be included in rayshade input files by enclosing text between the strings /* and */, as in the C programming language.